//
//  TripHeaderView.swift
//  AirlineReservation
//
//  Created by Kevin on 2020/1/21.
//  Copyright © 2020 Kevin. All rights reserved.
//

import UIKit

class TripHeaderView: UIView {
    
    // 里程
    public var ticketPrice:Int? {
        didSet {
           updateLayout()
        }
    }
    
    override func layoutSubviews() {
        // 里程
        let mileage = UILabel()
        mileage.text = "\(ticketPrice ?? 0)"
        mileage.textAlignment = .center
        mileage.textColor = UIColor.black
        mileage.font = UIFont.boldSystemFont(ofSize:20)
        mileage.frame = CGRect(x: 0, y: 0, width: frame.width, height: MARGIN40)
        addSubview(mileage)
        // 里程标题
        let mileageTitle = UILabel()
        mileageTitle.textAlignment = .center
        mileageTitle.textColor = UIColor.gray
        mileageTitle.font = UIFont.systemFont(ofSize: 11)
        mileageTitle.frame = CGRect(x: 0, y:MARGIN40, width: frame.width, height: MARGIN20)
        mileageTitle.text = "截止到\(AirLineUtil.shareInstance.getCurrentDate(isWeekDay: true))，您票价总数(人民币)"
        addSubview(mileageTitle)
    }
}
